import Vue from 'vue'
import VueRouter from 'vue-router'
import login from "../views/homepage/login";
import manage from "../views/manage/manage";
import listuser from "../views/manage/listuser";
import listQ from "../views/manage/listQ";
import listA from "../views/manage/listA";
import pastQ from "../views/manage/pastQ";
import pastPost from "../views/manage/pastPost";
import index from "../views/homepage/index";
import register from "../views/homepage/register";
import selfcenter from "../views/homepage/selfcenter";
import consult from "../views/homepage/consult";
import indexA from "../views/homepage/indexA";
import questiondetail from "../views/homepage/questiondetail";
import addaritype from "../views/manage/addaritype";
import listaritype from "../views/manage/listaritype";
import addaritag from "../views/manage/addaritag";
import listaritag from "../views/manage/listaritag";
import addArticle from "../views/manage/addArticle";
import listArticle from "../views/manage/listArticle";
import showarticle from "../views/homepage/showarticle";
import listByTagOrType from "../views/homepage/listByTagOrType";
import forum from "../views/homepage/forum";
import addPost from "../views/homepage/addPost";
import listPost from "../views/manage/listPost";
import showpost from "../views/homepage/showpost";
import forecast from "../views/homepage/forecast";
import listComment from "../views/manage/listComment";



Vue.use(VueRouter)


const routes = [
      {
        path: '/login',
        name: '登录模块',
        component: login
      },
      {
        path: '/manage',
        name: '后台管理',
        meta: {
          requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
        },
        component: manage,
        children:[
          {
            path: '/addarticle',
            name: '文章发布',
            component: addArticle,
          },
          {
            path: '/listarticle',
            name: '文章列表',
            component: listArticle,
          },
          {
            path: '/listuser',
            name: '用户信息编辑',
            component: listuser,
          },
          {
            path: '/listQ',
            name: '问题管理',
            component: listQ,
          },
          {
            path: '/listA',
            name: '回答管理',
            component: listA,
          },
          {
            path: '/pastQ',
            name: '问题过审',
            component: pastQ,
          },
          {
            path: '/pastPost',
            name: '帖子过审',
            component: pastPost,
          },
          {
            path:'/listPost',
            name:'帖子列表',
            component: listPost
          },
          {
            path:'/listComment',
            name:'帖子列表',
            component: listComment
          },
          {
            path: '/addaritype',
            name: '文章分类添加',
            component:addaritype
          },
          {
            path: '/listaritype',
            name: '文章分类列表',
            component:listaritype
          },
          {
            path: '/addaritag',
            name: '文章标签添加',
            component:addaritag
          },
          {
            path: '/listaritag',
            name: '文章标签列表',
            component: listaritag
          },

        ]
      },


      {
        path: '/',
        name: 'index',
        component: index,
        children:[
          {
            path: '/',
            name: '首页',
            component: indexA,

          },
          {
            path:'/listByTagOrType',
            name:'根据标签分类展示',
            component:listByTagOrType
          },
          {
            path:'/showarticle',
            name:'展示文章',
            component: showarticle,
          },
          {
            path: '/selfcenter',
            name: '个人中心',
            component: selfcenter
          },
          {
            path: '/forecast',
            name: '首页',
            component: forecast,

          },
          {
            path: '/consult',
            name: '咨询栏',
            component: consult
          },
          {
            path: '/questiondetail',
            name: '问题详情',
            component: questiondetail
          },
          {
            path:'/forum',
            name:'论坛中心',
            component:forum
          },
          {
            path:'/addpost',
            name:'发布帖子',
            component:addPost
          },
          {
            path:'/showPost',
            name:'展示帖子',
            component: showpost
          },

        ]
      },
      {
        path: "/register",
        name: '注册页',
        component: register
      }





]
const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
